<template>
  <div>
    <!-- zsj下拉菜单跳转页面 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item><a href="/">新房</a></el-breadcrumb-item>
      <el-breadcrumb-item>楼盘管理</el-breadcrumb-item>
    </el-breadcrumb>
    <HouseDetails :rowData="row"></HouseDetails>
    <el-tabs type="border-card" v-model="activeName">
      <el-tab-pane label="编辑楼盘概要" name="1">
        <BuildingProfile></BuildingProfile>
      </el-tab-pane>
      <el-tab-pane label="编辑参数" name="2">
        <BuildingDetailed></BuildingDetailed>
      </el-tab-pane>
      <el-tab-pane label="户型" name="3">
        <FloorBuildingHX @func="getData" v-if="state"></FloorBuildingHX>
        <SynopsisEditing v-if="stateDown"></SynopsisEditing>
      </el-tab-pane>
      <el-tab-pane label="价格" name="4">
        <FloorBuildingDataJG @func="getData" v-if="state"></FloorBuildingDataJG>
        <PriceEditing v-if="stateDown" :rowData="row"></PriceEditing>
      </el-tab-pane>
      <el-tab-pane label="相册" name="5">
        <FloorAlbum :rowData="row"></FloorAlbum>
      </el-tab-pane>
      <el-tab-pane label="开盘" name="6">
        <FloorBuildingDataKP @func="getData" v-if="state"></FloorBuildingDataKP>
        <FloorOpen v-if="stateDown" :rowData="row"></FloorOpen>
      </el-tab-pane>
      <el-tab-pane label="交房" name="7">
        <FloorAdminTable @func="getData" v-if="state"></FloorAdminTable>
        <FloorDelivery v-if="stateDown"></FloorDelivery>
      </el-tab-pane>
      <el-tab-pane label="预售许可证" name="8">
        <FloorBuildingDataYS @func="getData" v-if="state"></FloorBuildingDataYS>
      </el-tab-pane>
      <el-tab-pane label="楼栋/总平图" name="9">
        <FloorBuildingTabs :floorId="stateId"></FloorBuildingTabs>
      </el-tab-pane>
      <el-tab-pane label="编辑日志" name="10">
        <FloorAdminTable @func="getData" v-if="state"></FloorAdminTable>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import HouseDetails from "../components/HouseDetails";
import FloorAdminTable from "../components/FloorAdminTable";
import SynopsisEditing from "../components/SynopsisEditing";
import PriceEditing from "../components/PriceEditing";
import FloorBuildingTabs from "../components/FloorBuildingTabs";
import BuildingProfile from "../components/BuildingProfile";
import BuildingDetailed from "../components/BuildingDetailed";
import FloorBuildingHX from '../components/FloorBuildingHX';
// 价格
import FloorBuildingDataJG from '../components/FloorBuildingDataJG'
// 开盘
import FloorBuildingDataKP from '../components/FloorBuildingDataKP'
// 预售
import FloorBuildingDataYS from '../components/FloorBuildingDataYS'
import * as api from "../utils/api";
import { mapActions } from "vuex";
// 相册组件
import FloorAlbum from "../components/FloorAlbum";
// 开盘
import FloorOpen from '../components/FloorOpen';
// 交房
import FloorDelivery from '../components/FloorDelivery'
export default {
  name: "",
  data() {
    return {
      state: true,
      stateDown: false,
      row: [],
      activeName: "1",
      // 传过来的楼盘id
      real_estate_id: this.real_estate_id,
      // 装楼栋总平图的数组
      floorBuildingData: [],
      // 装户型的数组
      floorUnitType: [],
      // 装楼盘id和state的数组
      stateId:[]
    };
  },
  components: {
    HouseDetails,
    FloorAdminTable,
    SynopsisEditing,
    PriceEditing,
    FloorBuildingTabs,
    FloorAlbum,
    BuildingProfile,
    BuildingDetailed,
    FloorBuildingHX,
    FloorBuildingDataJG,
    FloorBuildingDataKP,
    FloorBuildingDataYS,
    FloorOpen,
    FloorDelivery
  },
  methods: {
    getRowData() {
      // 接收从RealEstateManagement页面传过来的数据
      this.row = this.$route.query.rowData;
      console.log(this.row);
      this.real_estate_id = this.row.real_estate_id;
      // let stateId
      // console.log(this.row);
      // 设置跳转页面后tabs选项卡展示正确那一项
      this.activeName = this.row.state;
      this.stateId.push(this.real_estate_id)
      this.stateId.push(this.activeName)
      this.stateId.push(this.row.property_type_id)
      var stateid={...this.stateId}
      console.log(stateid);
      this.$store.dispatch('queryBuilding',stateid)
      // console.log(this.row);
    },
    getData(data) {
      // 接收从FloorAdminTable传过来的值,判断编辑按钮是否被点击
      this.state = data;
      if (this.state === false) {
        this.stateDown = true;
      }
      // console.log(this.state);
    },
  },
  created() {
    this.getRowData();
    this.$store.state.FloorData;
  },
};
</script>

<style>
</style>